/*
    Android UIML

	Copyright (C) 2010  Bram Goffings (bramgoffings@gmail.com)

	This program is free software; you can redistribute it and/or
	modify it under the terms of the GNU Lesser General Public License
	as published by the Free Software Foundation; either version 2.1
	of	the License, or (at your option) any later version.

	This program is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU Lesser General Public License for more details.

	You should have received a copy of the GNU Lesser General Public License
	along with this program; if not, write to the Free Software
	Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
*/

package uiml.android.elements;

import java.util.ArrayList;

import org.w3c.dom.Element;

import uiml.android.template.Template;

public class Interface extends UimlElementWithAttributes{

	// TODO comment
	private ArrayList<Structure> structures = new ArrayList<Structure>();
	private ArrayList<Style> styles = new ArrayList<Style>();
	private ArrayList<Behavior> behaviors = new ArrayList<Behavior>();
	private ArrayList<Content> contents = new ArrayList<Content>();
	
	// TODO comment
	public static String IAM = "interface";
	public static String STRUCTURE = "structure";
	public static String STYLE = "style";
	public static String BEHAVIOR = "behavior";
	public static String CONTENT = "content";
	public static String LAYOUT = "layout";
	
	/**
	 * 
	 * @param node
	 */
	public Interface(Element node){
		super(node);
		System.out.println("Interface element aangemaakt");
		process();
	}

	/**
	 * 
	 */
	@Override
	protected Object clone() {
		// TODO Auto-generated method stub
		return null;
	}
	
	/**
	 * 
	 */
	@Override
	public void processElement(Element elem) {
		if(elem.getTagName().equals(STRUCTURE))
			structures.add(new Structure(elem));
		else if(elem.getTagName().equals(STYLE))
			styles.add(new Style(elem));
		else if(elem.getTagName().equals(CONTENT))
			contents.add(new Content(elem));
		else if(elem.getTagName().equals(BEHAVIOR))
			behaviors.add(new Behavior(elem));
	}
	
	/**
	 * 
	 * @param t
	 */
	public void applayCascadeTemplate(Template t) {
		
		Interface cascadeInterface = (Interface)t.getTop();
		
		structures.addAll(cascadeInterface.getStructures());
		styles.addAll(cascadeInterface.getStyles());
		behaviors.addAll(cascadeInterface.getBehaviors());
		contents.addAll(cascadeInterface.getContents());
	}
	
	/**
	 * 
	 * @return
	 */
	public ArrayList<Structure> getStructures() {
		return structures;
	}

	/**
	 * 
	 * @param structures
	 */
	public void setStructures(ArrayList<Structure> structures) {
		this.structures = structures;
	}

	/**
	 * 
	 * @return
	 */
	public ArrayList<Style> getStyles() {
		return styles;
	}

	/**
	 * 
	 * @param styles
	 */
	public void setStyles(ArrayList<Style> styles) {
		this.styles = styles;
	}

	/**
	 * 
	 * @return
	 */
	public ArrayList<Behavior> getBehaviors() {
		return behaviors;
	}

	/**
	 * 
	 * @param behaviours
	 */
	public void setBehaviors(ArrayList<Behavior> behaviors) {
		this.behaviors = behaviors;
	}

	/**
	 * 
	 * @return
	 */
	public ArrayList<Content> getContents() {
		return contents;
	}

	/**
	 * 
	 * @param contents
	 */
	public void setContents(ArrayList<Content> contents) {
		this.contents = contents;
	}

}
